﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;

namespace WebArchiveCopier.IO
{
	public class MemoryDataManager : IDataManager
	{
		private Dictionary<string, byte[]> cache = new Dictionary<string, byte[]>();

		public byte[] GetData(string address)
		{
			if (!cache.ContainsKey(address))
			{
				AdvancedWebClient client = new AdvancedWebClient();
				cache[address] = client.DownloadData(address);
			}

			return cache[address];
		}

		public byte[] GetData(string address, DateTime date)
		{
			return GetData(address);
		}

		public byte[] GetData(string address, string originalAddress, DateTime date, bool skipIfPresent)
		{
			return GetData(address);
		}
	}
}
